package com.practice.controller.user;


import com.practice.common.result.Result;
import com.practice.pojo.user.dto.PageQueryDTO;
import com.practice.pojo.user.dto.RegisterMessageDTO;
import com.practice.service.user.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Jasmine
 * @since 2023-05-14
 */
@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IndexService indexService;
    
    @GetMapping("/index")
    public Result index(){
        return indexService.index();
    }

    @GetMapping("/new")
    public Result news(PageQueryDTO dto){
        return indexService.news(dto);
    }

    @GetMapping("/list")
    public Result list(PageQueryDTO dto){
        return indexService.list(dto);
    }

    @PostMapping("/reg")
    public Result reg(@RequestBody RegisterMessageDTO dto){
        return indexService.reg(dto);
    }

    @GetMapping("/hot")
    public Result hot(){
        return indexService.hot();
    }
    
    @GetMapping("/recommend")
    public Result recommend(){
        return indexService.recommend();
    } 
    
    @GetMapping("/show")
    public Result show(Long id){
        return indexService.show(id);
    }
}
